package com.qf.listener;

import com.qf.constant.RabbitMQConstants;
import com.qf.model.StandardReport;
import com.qf.model.StandardSubmit;
import com.qf.service.SearchService;
import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author Zwnan
 */
@Component
public class ReportListener {

    @Autowired
    private SearchService searchService;

    @RabbitListener(queues = RabbitMQConstants.TOPIC_UPDATE_SMS_REPORT)
    public void consume(StandardReport report, Message message, Channel channel)throws Exception{

        searchService.updateLog(report);
        channel.basicAck(message.getMessageProperties().getDeliveryTag(),false);


    }


}
